﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using FluentValidation;
using Peak.Core;
using Peak.Resources;

namespace Peak.Web.Controllers.Models
{
  class TaskModelValidator : AbstractValidator<TaskModel>
  {
    public TaskModelValidator()
    {
      RuleFor(f => f.Name).NotNull().NotEmpty();
      RuleFor(f => f.RemainingEffort).GreaterThanOrEqualTo(new TimeSpan());
      RuleFor(f => f.AssignedTo).NotNull().When(s=>s.Status != TaskStatus.ToDo);
    }
  }
}
